import { getFormFields } from '@/utils/formUtils'
import type { FormFieldConfig } from '@/types/form'

// 表格列配置
export const tableColumns = [
  {
    title: 'ID',
    dataIndex: 'id',
  },
  {
    title: '銷售指標金額',
    dataIndex: 'targetAmount',
  },
  {
    title: '獎金金額',
    dataIndex: 'bonusAmount',
  },

  {
    title: '最後修改人',
    dataIndex: 'updatedBy',
  },
  {
    title: '最後修改時間',
    dataIndex: 'updatedAt',
  },
  {
    title: '操作',
    key: 'action',
    align: 'center',
  },
]

//表單
export const FormField: Record<string, FormFieldConfig> = {
  targetAmount: {
    label: '銷售指標金額',
    type: 'number',
    placeholder: '請輸入銷售指標金額',
    min: 0,
    addonBefore: '$',
  },
  bonusAmount: {
    label: '獎金金額',
    type: 'number',
    placeholder: '請輸入獎金金額',
    min: 0,
    addonBefore: '$',
  },
}

// 創建表單字段
export const getCreteFieldConfig = (fields?: string[]) => {
  return getFormFields(FormField, fields)
}

export const getEditFieldConfig = (fields?: string[]) => {
  return getFormFields(FormField, fields)
}
